package com.ease.archiecture.springjdbc;

import com.ease.archiecture.springjdbc.entity.TestUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface UserMapper {

    @Select("SELECT * FROM test1 WHERE NAME = #{name}")
    @Cacheable(value = "users")
    List<TestUser> findByName(@Param("name") String name);


    @Insert("INSERT INTO test1(ID,NAME, AGE) VALUES(#{id},#{name}, #{age})")
    int insert(@Param("id") String id, @Param("name") String name, @Param("age") Integer age);
}
